import request from '@/utils/request'

// 查询项目估值列表
export function listDealAnalysisValuation(query) {
  return request({
    url: '/analysisValuation/dealAnalysisValuation/list',
    method: 'get',
    params: query
  })
}

// 查询项目估值详细
export function getDealAnalysisValuation(id) {
  return request({
    url: '/analysisValuation/dealAnalysisValuation/' + id,
    method: 'get'
  })
}

// 保存项目估值
export function saveDealAnalysisValuation(data) {
  return request({
    url: '/analysisValuation/dealAnalysisValuation/save',
    method: 'post',
    data: data
  })
}

// 删除项目估值
export function delDealAnalysisValuation(id) {
  return request({
    url: '/analysisValuation/dealAnalysisValuation/' + id,
    method: 'delete'
  })
}

// 导出项目估值
export function deleteAnalysisValuationMethod(id) {
  return request({
    url: '/analysisValuation/dealAnalysisValuation/method/' + id,
    method: 'delete'
  })
}

export function getDealAnalysisValuationLoadData(dealId) {
  return request({
    url: '/analysisValuation/dealAnalysisValuation/loadData/' + dealId,
    method: 'get'
  })
}

// 获取PE或PB方法的基础信息
export function getValuationMethodPepb(dealId, code, time) {
  return request({
    url: '/analysisValuation/dealAnalysisValuation/method/pepbInfo/' + dealId + '/' + code + '/' + time,
    method: 'get'
  })
}

export function pepbByQuarterData(data) {
  return request({
    url: '/analysisValuation/dealAnalysisValuation/method/pepbByQuarterData',
    method: 'post',
    data: data
  })
}

export function pepbStockCode(code, type, time) {
  return request({
    url: 'analysisValuation/dealAnalysisValuation/method/pepbStockCode/' + code + '/' + type + '/' + time,
    method: 'get'
  })
}

export function getValuationLastTimeByTime(dealId, time) {
  return request({
    url: '/analysisValuation/dealAnalysisValuation/lastTime/' + dealId + '/' + time,
    method: 'get'
  })
}

// 获取成本法的基础信息
export function getValuationMethodLawCosts(dealId) {
  return request({
    url: '/analysisValuation/dealAnalysisValuation/method/lawCosts/' + dealId,
    method: 'get'
  })
}

// 获取回购法的基础信息
export function getValuationMethodRepurchase(dealId) {
  return request({
    url: '/analysisValuation/dealAnalysisValuation/method/repurchase/' + dealId,
    method: 'get'
  })
}

// 回购法缓存约定时间/金额 /method/repurchase/saveCache
export function saveRepurchaseCache(dealId, time, money) {
  money = money + ''
  return request({
    url: '/analysisValuation/dealAnalysisValuation/method/repurchase/saveCache/' + dealId + '/' + time + '/' + money,
    method: 'get'
  })
}

// 最新融资法获取基础信息
export function getValuationMethodFinancingInfo(dealId) {
  return request({
    url: '/analysisValuation/dealAnalysisValuation/method/financing/' + dealId,
    method: 'get'
  })
}

// 最新融资法缓存数据 financing/saveCache
export function saveMethodFinancingCache(data) {
  return request({
    url: '/analysisValuation/dealAnalysisValuation/method/financing/saveCache',
    method: 'post',
    data: data
  })
}

// 列表6个指标 /listPage/indicators
export function getListIndicators() {
  return request({
    url: '/analysisValuation/dealAnalysisValuation/listPage/indicators',
    method: 'get'
  })
}

// 列表echart图 /listPage/echart
export function getListEchart() {
  return request({
    url: '/analysisValuation/dealAnalysisValuation/listPage/echart',
    method: 'get'
  })
}

// 列表季度变化 /listPage/change
export function getListChange(quarter) {
  return request({
    url: '/analysisValuation/dealAnalysisValuation/listPage/change/' + quarter,
    method: 'get'
  })
}
